package czc.hly.spring.formework.beans;

import czc.hly.spring.formework.core.FactoryBean;

/**
 * Created by Administrator on 2018\10\31 0031.
 */
//spring里是接口，为了方便这个地方用类
public class BeanWrapper extends FactoryBean{

    //还会用到观察者模式
    //1、支持事件响应，会有一个监听
    private BeanPostProcessor postProcessor;


    private Object wrappedInstance;
    //原始的通过反射new出来，要把包装起来，存起来
    private Object originalInstance;


    public BeanWrapper(Object instance){
        this.wrappedInstance = instance;
        this.originalInstance = instance;
    }


    public Object getWrapperInstance(){
        return this.wrappedInstance;
    }
    //返回代理以后的Class
    //可能会是这个$Proxy0
    public Class<?> getWrappedClass(){
        return this.wrappedInstance.getClass();
    }

    public BeanPostProcessor getPostProcessor() {
        return postProcessor;
    }

    public void setPostProcessor(BeanPostProcessor postProcessor) {
        this.postProcessor = postProcessor;
    }
}
